package  ch.usi.inf.pf2.CSV;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.StringTokenizer;

/**
* mona.esmaili@gmail.com && ehsan.vala@gmail.com
*/
public class read

{ 

@SuppressWarnings("deprecation")
public static void main(String args[]) throws IOException 

{ 

// name file.
String Namefile = "/file01.csv";

//string variable which take each record at a time
String thisLine;

//A FileInputStream obtains input bytes from a file in a file system.For reading streams of characters, consider using FileReader.
// Creates a FileInputStream by opening a connection to an actual file.
FileInputStream file = new FileInputStream(Namefile); 

//data input stream lets an application read primitive Java data types 
//from an underlying input stream in a machine-independent way
DataInputStream myInput = new DataInputStream(file);


while ((thisLine = myInput.readLine()) != null)
{ 
	StringTokenizer st =new StringTokenizer(thisLine,",");
	while(st.hasMoreElements()){
		String field = st.nextToken();
		System.out.print(field+", ");
}
System.out.println();

} 
} 
} 